Skip to content

Fix bypassing target admin delay using execute#6388

Merged
Amxx merged 5 commits intoOpenZeppelin:masterfrom
Amxx:fix/access-manager/execute-bypass-targetAdminDelay
Mar 3, 2026
Merged

Fix bypassing target admin delay using execute#6388
Amxx merged 5 commits intoOpenZeppelin:masterfrom
Amxx:fix/access-manager/execute-bypass-targetAdminDelay

Conversation

@Amxx
Copy link
Collaborator

@Amxx Amxx commented Mar 3, 2026

Fixes H-01

Note: with these cahnges, we could technically get rid of the "updateAuthority" function and just use execute instead. That would be a breaking change. Maybe for 6.0 ???

PR Checklist

  • Tests
  • Documentation
  • Changeset entry (run npx changeset add)

@Amxx Amxx requested a review from ernestognw March 3, 2026 16:42
@Amxx Amxx requested a review from a team as a code owner March 3, 2026 16:42
@Amxx Amxx added the security Pull requests that address a security vulnerability label Mar 3, 2026
@changeset-bot
Copy link

changeset-bot bot commented Mar 3, 2026

🦋 Changeset detected

Latest commit: dc7e2de

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
openzeppelin-solidity Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 3, 2026

Walkthrough

A new test case was added to the AccessManager test suite that validates the ability to execute calls that bypass a target's admin delay when updating authority. The test deploys an authority contract, applies an admin delay to the target, advances time beyond the setback period, verifies that a direct updateAuthority call is blocked with a NotScheduled error, then uses execute to invoke setAuthority on the target and confirms the operation succeeds by checking for an AuthorityUpdated event.

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title directly relates to the main change: fixing a security issue where execute can bypass target admin delay.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Description check ✅ Passed The PR description clearly references a specific security audit issue (H-01) and explains the purpose of preventing target admin delay bypass via execute.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
test/access/manager/AccessManager.test.js (1)

1686-1686: Use MINSETBACK instead of duplicating 5n * 86400n.

This keeps the test aligned with the canonical constant and avoids drift.

♻️ Proposed cleanup
-      await time.increaseBy.timestamp(5n * 86400n, true); // minSetBack is 5 days
+      await time.increaseBy.timestamp(MINSETBACK, true);
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@test/access/manager/AccessManager.test.js` at line 1686, Replace the
hardcoded duration 5n * 86400n in the test call to time.increaseBy.timestamp
with the canonical constant MINSETBACK to avoid duplication; update the test to
use MINSETBACK (e.g., time.increaseBy.timestamp(MINSETBACK, true)) and ensure
MINSETBACK is referenced/imported the same way other tests use it so the test
stays synced with the source constant (target the line containing
time.increaseBy.timestamp and the test file's imports/consts).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@test/access/manager/AccessManager.test.js`:
- Around line 1681-1703: The test currently asserts that calling
this.manager.connect(this.admin).execute(this.target,
this.target.interface.encodeFunctionData('setAuthority', [newAuthority.target]))
succeeds, which preserves the bug; change the expectation to require a revert
with the same AccessManagerNotScheduled error (or appropriate custom error) and
assert that the target's authority did not change (e.g., call
this.target.authority() or the relevant getter and expect it to equal the
original authority), and remove the .to.emit(...
'AuthorityUpdated')/.withArgs(newAuthority) assertions; keep references to
$_setTargetAdminDelay, getTargetAdminDelay, updateAuthority, execute,
setAuthority, this.manager, this.target and newAuthority to locate the code.

---

Nitpick comments:
In `@test/access/manager/AccessManager.test.js`:
- Line 1686: Replace the hardcoded duration 5n * 86400n in the test call to
time.increaseBy.timestamp with the canonical constant MINSETBACK to avoid
duplication; update the test to use MINSETBACK (e.g.,
time.increaseBy.timestamp(MINSETBACK, true)) and ensure MINSETBACK is
referenced/imported the same way other tests use it so the test stays synced
with the source constant (target the line containing time.increaseBy.timestamp
and the test file's imports/consts).

ℹ️ Review info

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between ca6f5fa and ccd5264.

📒 Files selected for processing (1)
  • test/access/manager/AccessManager.test.js

@Amxx Amxx added this to the 5.7 milestone Mar 3, 2026
@Amxx Amxx requested a review from frangio March 3, 2026 17:11
@Amxx Amxx merged commit fb30ada into OpenZeppelin:master Mar 3, 2026
19 checks passed
@Amxx Amxx deleted the fix/access-manager/execute-bypass-targetAdminDelay branch March 3, 2026 17:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

security Pull requests that address a security vulnerability

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants